package com.cloudminds.resttest.ice;


import Ice.ObjectPrx;

/**
 * Created by zoey on 2018/10/15.
 */

public class SObjPrx implements  Comparable<SObjPrx> {

    private ObjectPrx objectPrx;
    private int seq = 0;
    private String robotType = "";
    private String tenantId = "";
    private String serviceCode = "";

    public SObjPrx(ObjectPrx prx){
        if (prx != null){
            this.objectPrx = prx;
            String iceIds = objectPrx.ice_getIdentity().name;
            String[] ids = iceIds.split("," , -1);
            if (ids.length >= 5){
                this.seq = Integer.valueOf(ids[1]);
                this.robotType = ids[2];
                this.tenantId = ids[3];
                this.serviceCode = ids[4];
            }
        }
    }

    public int getSeq(){
        return seq;
    }

    public ObjectPrx getObjectPrx(){
        return objectPrx;
    }

    public String getRobotType(){
        return robotType;
    }

    public String getTenantId(){
        return tenantId;
    }

    public String getServiceCode(){
        return serviceCode;
    }

    @Override
    public int compareTo(SObjPrx o) {

        return this.seq-o.seq;
    }
}
